Expose IsSticky() on SlotReservationInfo for sticky queue awareness#2193
Open
billrich2001 wants to merge 5 commits intomainfrom
Open
Expose IsSticky() on SlotReservationInfo for sticky queue awareness#2193billrich2001 wants to merge 5 commits intomainfrom
billrich2001 wants to merge 5 commits intomainfrom
Conversation
Expose a boolean on SlotReservationInfo so that custom SlotSupplier implementations can know whether a slot reservation is for a sticky workflow task queue poll. This brings the Go SDK in line with other Temporal SDKs (fixes #2191). For dedicated Sticky-mode pollers the flag is accurate. For mixed-mode pollers (the default) the flag returns false because the sticky-vs-normal decision is made after slot reservation. Co-authored-by: Cursor <cursoragent@cursor.com>
Move the sticky/normal poll decision before slot reservation so that SlotSupplier.ReserveSlot receives an accurate IsSticky() value even when the worker uses a mixed-mode poller (the default for non-autoscaling workers). Key changes: - Add pollHint struct to carry pre-decided sticky/normal choice - Add decideNextPollKind() / undoPollDecision() on workflowTaskPoller - Modify getNextPollRequest() to accept a *pollHint and skip inline re-decision when a hint is provided - Thread the hint through taskPoller.PollTask -> poll -> getNextPollRequest - Handle cancellation cleanup (undo counters if reservation fails) - Expand test coverage for counter lifecycle and hint propagation Co-authored-by: Cursor <cursoragent@cursor.com>
Update PollTask signature on the test mock to accept *pollHint, matching the interface change from the previous commit. Co-authored-by: Cursor <cursoragent@cursor.com>
d635ac7 to
8e4ec8b
Compare
billrich2001
commented
Feb 13, 2026
Author
There was a problem hiding this comment.
Stupid AI did a push --force-with-lease including this nonsense from something unrelated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IsSticky() boolto theSlotReservationInfointerface so that customSlotSupplierimplementations can distinguish sticky vs normal workflow task queue polls at slot reservation time.ReserveSlotsoIsSticky()is accurate for all poller configurations.IsSticky()always returnsfalse.Fixes #2191
Approach
Commit 1 -- Add
IsSticky()to the public interface:SlotReservationInfowithIsSticky() boolisStickythroughslotReservationDataandtrackingSlotSupplierrunPollerCommit 2 -- Make
IsSticky()accurate for mixed-mode pollers:pollHintstruct to carry a pre-decided sticky/normal choicedecideNextPollKind()onworkflowTaskPollerwhich commits to sticky vs normal before slot reservation (using the same backlog/pending-count balancing logic)getNextPollRequest()to honor the pre-decided hint, skipping the inline re-decisiontaskPoller.PollTask()->poll()->getNextPollRequest()undoPollDecision()reverses the counter increment if reservation fails or is cancelledTest plan
decideNextPollKind()across all modes (Sticky, NonSticky, Mixed with balancing, backlog, disabled cache)undoPollDecision()(Mixed and non-Mixed)getNextPollRequest()with and without hintgo vetand linter cleanMade with Cursor